#ifndef algorithm_HPP__
#define algorithm_HPP__

#include "ranges.hpp"			//TODO: remove this dependence...

template <typename R, typename T>
R find(R r, T value) 
{
	for ( ; !r.empty(); r.popFront() )
	{
		if ( value == r.front() ) break;
	}
	return r;
}

template<typename R, typename T>
R find_end(R r, T value) 
{
	return retro( find( retro(r), value ) );
}


#endif // algorithm_HPP__
